package com.ttcaca.cas.android.client;

import android.content.Context;

import com.magicsoft.app.helper.SharePreferenceHelper;
import com.ttcaca.cas.android.client.model.User;

public class Main {

//	public static String CAS_DOMAIN = "http://54.223.196.88:8889/";// 预正式cas平台地址
//	public static String CAS_DOMAIN = "http://54.223.171.230:8889/";// 云测试cas平台地址
//	 public static String CAS_DOMAIN = "http://icesso.colourlife.com:8889/";//
	 public static String CAS_DOMAIN = "http://42.62.50.218:8889/";
	// 正式 cas平台地址

	public static String SERVICE = "http://www.kktool.com";// 接入方域名，不需要一定可以访问，只是一个应用标识

	public static String PWD = "_aA3daa"; // 通信秘钥

	public static String CORPID = "1";// 合作方id

	public static CasClient c = new CasClient(CAS_DOMAIN, SERVICE, CORPID, PWD);

	public static void main(Context context) {

		// CasClient c = new CasClient(CAS_DOMAIN, SERVICE, CORPID, PWD);

		try {

			User userinfo = c.login("mytest", "123456");

			System.out.println("用户信息：" + userinfo);
			System.out.println("tgc：" + c.getTgc());

			SharePreferenceHelper.saveAccount(context, userinfo);
			SharePreferenceHelper.setStringValue(context, "COOKIE", c.getTgc());
			// 利用该方法延长登录状态
			c.check(c.getTgc());
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}

}
